﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Net
{
    using System;
    using System.Reflection;

    /// <summary>This is a helper for <see cref="Parser{T}"/>.</summary>
    internal sealed class ParserHelper
    {
        private const BindingFlags BindNonPublicly = BindingFlags.NonPublic | BindingFlags.Static;
        private const BindingFlags BindPublicly = BindingFlags.Public | BindingFlags.Static;
        private static readonly Type[] parseParameters = new Type[] { typeof(string) };

        internal static MethodInfo GetParseMethod<T>(string name, bool nonPublic)
        {
            return typeof(T).GetMethod(name, nonPublic ? BindNonPublicly : BindPublicly, null, parseParameters, null);
        }

        internal static string ParseString(string s)
        {
            return s;
        }
    }
}
